
#ifndef __SOFTSPI_H__
#define __SOFTSPI_H__

#include "platform.h"


/**
 * @brief SoftSpi 结构体，不含片选信号
 * 
 */
typedef struct __sspi_t__ {
    volatile uint32_t  *port     ;
    volatile int8_t          clock_pin;
    volatile int8_t          mosi_pin ;
    volatile int8_t          miso_pin ;
    volatile uint8_t delay_ticks ;
    volatile int8_t          cpol ;
    volatile int8_t          cpha;
} SPI_t ;

/**
 * @brief SoftSpi init
 * 
 * @param spi 
 * @param _port 
 * @param _clock_pin 
 * @param _mosi_pin 
 * @param _miso_pin 
 * @param _cpol 
 * @param _cpha 
 * @param _delay_ticks 
 */
void SoftSpi_Init(
    SPI_t *spi ,
    volatile uint32_t *_port ,     
    int8_t _clock_pin,
    int8_t _mosi_pin ,
    int8_t _miso_pin ,
    int8_t _cpol , 
    int8_t _cpha ,
    uint8_t _delay_ticks 
) ;

uint8_t SoftSpi_Write(SPI_t *spi,uint8_t _value  )  ;



#endif 
